from flask import Flask

# 蓝图
from .views.login import blogin
from .views.index import bindex


def create_app():
    app = Flask(__name__)
    app.secret_key = "q1w2e3r4t5y6u7i8o9p0"

    @app.route("/index")
    def index():
        return "index"

    # 注册蓝图
    # url_prefix设置url前缀，类似路由分发，防止路由重名【可选】
    app.register_blueprint(blogin, url_prefix="/login")
    app.register_blueprint(bindex, url_prefix="/index")

    return app
